<script lang="ts" setup>
// #region 引入包, 函数和组件
import { ref } from "vue"
// #endregion

// #region // 使用模块(仓库、路由、父组件参数函数)

// #endregion

// #region // 变量
const drawerRef = ref<{ close: () => void; open: () => void } | null>(null)
// #endregion

// #region // 函数
const close = () => {
  if (drawerRef.value) {
    drawerRef.value.close()
  }
}
const open = () => {
  if (drawerRef.value) {
    drawerRef.value.open()
  }
}
// #endregion

// #region // 生命周期和vue函数
defineExpose({
  open,
  close,
})
// #endregion
</script>

<template>
  <uni-drawer ref="drawerRef" :width="300">
    <scroll-view
      style="height: 100%"
      scroll-y="true"
    >
      <view
        v-for="item in 60"
        :key="item"
        >可滚动内容 {{ item }}</view
      >
    </scroll-view>
  </uni-drawer>
</template>

<style lang="scss" scoped>
</style>
